﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edge.Business.Entities;
using Shop.Business.Domain.Catalog;

namespace Shop.Business.Domain.Pricing
{
    /// <summary>
    /// Users object for NHibernate mapped table 'price'.
    /// </summary>
    [Serializable]
    public class PriceItem : EntityWithStat<int>
    {
        protected Product product;
        protected decimal price;
        protected decimal wholesellPrice;
        protected int qty;
        protected int margin;
        protected string note;

        public virtual Product Product
        {
            get { return product; }
            set { product = value; }
        }

        public virtual decimal Price
        {
            get { return price; }
            set { price = value; }
        }

        public virtual decimal WholesellPrice
        {
            get { return wholesellPrice; }
            set { wholesellPrice = value; }
        }

        public virtual int Qty
        {
            get { return qty; }
            set { qty = value; }
        }

        public virtual int Margin
        {
            get { return margin; }
            set { margin = value; }
        }

        public virtual string Note
        {
            get { return note; }
            set { note = value; }
        }

        public virtual string ToString()
        {
            string ret = "xxx<br/>руб.";
            if (Price > 0)
            {
                ret = ((int)Math.Round(Price)).ToString() + "<br/>руб.";
            }
            return ret;
        }
    }
}